<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,user-scalable=no,minimal-ui">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="icon" href="../img/asset-favico.ico">
        <title>传智健康</title>
        <link rel="stylesheet" href="../css/page-health-index.css" />
        <link rel="stylesheet" href="../css/page-health-login.css" />
        <link rel="stylesheet" href="../css/page-health-order.css" />
        <link rel="stylesheet" href="../plugins/elementui/index.css" />
        <script src="../plugins/jquery/dist/jquery.min.js"></script>
        <script src="../plugins/healthmobile.js"></script>
        <script src="../plugins/elementui/index.js"></script>
        <style>
            .button {
                background-color: #4CAF50; /* Green */
                border: none;
                color: white;
                padding: 5px 32px;
                text-align: center;
                text-decoration: none;
                display: inline;
                font-size: 16px;
                margin-left: 25px;
            }
        </style>
        <script>
            var id = getUrlParam("id");//从URL地址栏获取体检套餐id
        </script>
    </head>
    <body data-spy="scroll" data-target="#myNavbar" data-offset="150">
        <div id="app" class="app">
            <!-- 页面头部 -->
            <div class="top-header">
                <span class="f-left"><i class="icon-back" onclick="history.go(-1)"></i></span>
                <span class="center">健康干预</span>
                <span class="f-right"><i class="icon-more"></i></span>
            </div>
            <!-- 页面内容 -->
            <div class="contentBox">
                <div class="form-info">
                    <form class="info-form">
                        <div class="input-row">
                            起始日期:<input v-model="orderInfo.startDate" style="width: 70%;height: 30px;border: 0px" type="date" class="input-clear">
                        </div>
                        <div class="input-row" >
                            截止日期:<input v-model="orderInfo.endDate" style="width: 70%;height: 30px;border: 0px" type="date" class="input-clear">
                            <span class="box-button" >
                            <button @click="findSetmealByIdAndDate()" type="button" class="button">查询</button>
                            </span>
                        </div>
                    </form>

                </div>
                <div class="list-column1">
                    <ul class="list"
                        v-infinite-scroll="load"
                        infinite-scroll-disabled="disabled">
                        <li class="list-item" v-for="data in dataList">
                            <!--<a class="link-page" :href="'setmeal_detail.html?id='+data.id">-->
                            <!--@click="findSetmeal()"-->
                            <a class="link-page" :href="'#'" @click="findIntervention(data.id)">
                                <img class="img-object f-left" :src="'http://qge28gq7m.hb-bkt.clouddn.com/'+data.img" alt="">
                                <div class="item-body">
                                    <h3 class="ellipsis item-title">体检人:{{data.sname}}</h3>
                                    <p class="ellipsis-more item-desc">{{data.name}}</p>
                                    <p class="item-keywords">
                                        <span class="item-keywords">{{data.age}}</span>
                                        <span>{{data.msex == '1' ? '男':'女'}}</span>
                                    </p>
                                    <p>{{data.orderDate}}</p>
                                    <p>{{data.orderType}}</p>
                                    <p>{{data.orderStatus}}</p>
                                </div>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <script src="../plugins/vue/vue.js"></script>
        <script src="../plugins/vue/axios-0.18.0.js"></script>
        <script>
            var vue = new Vue({
                el: '#app',
                data: {
                    dataList: [

                    ],//套餐列表数据
                    orderInfo: {
                        id:id,
                        startDate: '',
                        endDate: ''
                    }
                },
                methods: {
                    findIntervention(setmealId){
                        window.location.href="/pages/health_intervention_detail.html?id="+id+"&setmealId="+setmealId;
                    },
                    ///pages/health_intervention_detail.html
                    findSetmeal(){
                        axios.get("/member/findIntervention.do?id="+this.dataList.data.id).then((rep)=>{
                            if (rep.data.flag) {
                                this.$message.success("成功");
                            }else {
                                this.$message.error("失败");
                            }
                        });
                    },
                    //查询个人预约套餐
                    findSetmealByIdAndDate() {
                        //var id = this.orderInfo.id;
                        var startDate = this.orderInfo.startDate;
                        var endDate = this.orderInfo.endDate;
                        if (startDate == "") {
                            this.$message.error("开始日期不能为空,请检查后重新输入!");
                            return false;
                        }
                        if (endDate == "") {
                            this.$message.error("结束日期不能为空,请检查后重新输入!");
                            return false;
                        }
                        axios.post("/member/findSetmealByIdAndDate.do", this.orderInfo).then((res) => {
                            if (res.data.flag) {
                                this.dataList = res.data.data;
                            } else {
                                this.$message.error(res.data.message);
                            }
                        });
                    }
                },
                mounted() {
                    axios.get("/member/findSetmealById.do?id=" + id).then((res) => {
                        if (res.data.flag) {
                            this.dataList = res.data.data;
                        } else {
                            this.$message.error(res.data.message);
                        }
                    });
                }
            });
        </script>
    </body>
</html>